home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
ntjbnd.arc
/
JUL-BND.PAS
Wrap
Pascal/Delphi Source File
|
1989-03-25
|
10KB
|
370 lines
Uses Dos;
Type
HalfRegType = record
Al,Ah,Bl,Bh,Cl,Ch,Dl,Dh:byte
end;
MyWord = record
wh,wl : byte;
end;
Longs = record
ah,al,bh,bl:byte;
end;
PropCall = record
native : MyWord;
func : Byte; { func 0x3e }
objtyp : MyWord;
objnamel : Byte;
objname : array[1..512] of byte;
end;
CreateCall = record
native : MyWord;
func : Byte;
flags : Byte;
security : Byte;
objtyp : MyWord;
objnamel : byte;
objname : array[1..48] of byte;
end;
CreateRply = record
native : MyWord;
end;
ReadPropertyc = record
native : MyWord;
func : byte;
objTyp : MyWord;
objNmel: byte;
objName: array[1..200] of byte;
end;
ReadPropertyr = record
native : MyWord;
data : array[1..128] of byte;
more : byte;
flags : byte;
end;
{ now, some common variable definitions }
var
regs : Registers; { innate to Turbo Pascal v4.0 and v5.0 }
hr : HalfRegType absolute Regs;
sc : CreateCall;
sr : CreateRply;
pc : PropCall;
rpc : ReadPropertyc;
rpr : ReadPropertyr;
a,b : integer;
Procedure CheckSuccess;
Begin
{ this routine will look at the current value of hr.al (al part of }
{ AX register) and determine proper message }
If hr.al = 0 then { if we can create the lock... }
Begin
WriteLn('Operation successfully completed!');
End
ELSE { there was an error, print it out if a common one }
Case hr.al of
237: WriteLn('Property already exists');
238: WriteLn('Object already exists');
239: WriteLn('Object name contains illegal characters');
240: WriteLn('Attempt to use wild cards in wrong place');
245: WriteLn('No Object Creation or Change privileges');
247: WriteLn('No Property Creation or Change privileges for object');
248: WriteLn('No Write privileges for property');
249: WriteLn('No Read privileges for property');
251: WriteLn('No such Property');
252: WriteLn('No such Object');
253: WriteLn('Unknown bindery request');
254: WriteLn('Bindery temporarily locked, try later');
255: WriteLn('Unrecoverable/Unknown error');
else WriteLn('Unknown error code: ',hr.al);
end; {of case}
End; { of CheckSuccess }
Procedure CreateObject;
var
user : Longs;
Begin
With sc do
Begin
native.wh := $07; { set up request packet size }
{ note that this size will vary with }
{ the length of the object name }
native.wl := $00;
sr.native.wh := $FF; { set up reply packet size }
sr.native.wl := $00;
func := $32; { create object }
flags := $01; { dynamic }
security := $11; { Write Security is most significant }
{ nybble of the security byte: }
{ 0=anyone, even if not logged in }
{ 1=anyone logged in }
{ 2=any object or supervisor }
{ 3=only supervisors }
{ 4=bindery only }
{ Read Security is least significant }
{ nybble of the security byte: }
{ 0=anyone, even if not logged in }
{ 1=anyone logged in }
{ 2=any object or supervisor }
{ 3=only supervisors }
{ 4=bindery only }
{ thus security = 0x11 write/read by anyone logged in }
objtyp.wh := $88; { set up object type }
objtyp.wl := $88;
objnamel := 1; { set up obj name length that follows }
objname[1] := 74; { define a name "J", cute huh? 74=ASCII J }
end; { of with sc }
hr.ah := $E3; { 0xE3 is Novell's API code }
With regs do
Begin
DS := seg(sc); { set up pointers to seg:ofs of request packet }
SI := ofs(sc);
ES := seg(sr); { set up pointers to seg:ofs of reply packet }
DI := ofs(sr);
end; { of regs }
MsDos(regs); { call DOS, try to create }
CheckSuccess;
End; { of CreateObject }
Procedure CreateProp;
Begin
{ note this only creates the property, no value has yet been }
{ established }
With pc do
Begin
sr.native.wl := $00;
sr.native.wh := $FF;
native.wl := $00;
native.wh := 21+17; { 17 is length of the name, the only variable }
{ in the length of the request packet }
Func := $39; { add a property to an object }
objtyp.wl := $88;
objtyp.wh := $88;
ObjNamel := 1; { object name length }
ObjName[1] := 74; { the name of "J" again }
ObjName[1+1] := $00; { 00= Static Flag and an item type object }
{ 01= Dynamic Flag, the byte immediately }
{ 02= Static Flag an a set type object }
{ following the last character of the }
{ name, hence 1+1 for clarity only }
ObjName[1+2] := $11;{ Security, 11 = any logged in }
ObjName[1+3] := 14; { PropName Length }
ObjName[1+4] :=$49; { I }
ObjName[1+5] :=$44; { D }
ObjName[1+6] :=$45; { E }
ObjName[1+7] :=$4E; { N }
ObjName[1+8] :=$54; { T }
ObjName[1+9] :=$49; { I }
ObjName[1+10]:=$46; { F }
ObjName[1+11]:=$49; { I }
ObjName[1+12]:=$43; { C }
ObjName[1+13]:=$41; { A }
ObjName[1+14]:=$54; { T }
ObjName[1+15]:=$49; { I }
ObjName[1+16]:=$4F; { O }
ObjName[1+17]:=$4E; { N }
end; { of with pc }
with regs do
Begin
AX:=$E300;
ES:=Seg(sr);
DI:=Ofs(sr);
DS:=Seg(pc);
SI:=Ofs(pc);
end; { of with regs }
MsDos(regs);
CheckSuccess;
End; { of CreateProp }
Procedure WriteProp;
Begin
With pc do
Begin
sr.native.wl := $00;
sr.native.wh := $FF;
native.wl := $00;
native.wh := 135+1+14; { fixed length + object name + property }
{ name length }
Func := $3E;{ Write a Property Value }
objtyp.wl := $88;{ object type }
objtyp.wh := $88;
ObjNamel := 1; { object name length }
ObjName[1] := 74; { object name }
ObjName[1+1] := 1; { Segment Number }
ObjName[1+2] := 0; { More Flag, 0 = last segment, any existing }
{ segments beyond this one will be deleted }
ObjName[1+3] := 14; { PropName Length }
ObjName[1+4] :=$49; { I }
ObjName[1+5] :=$44; { D }
ObjName[1+6] :=$45; { E }
ObjName[1+7] :=$4E; { N }
ObjName[1+8] :=$54; { T }
ObjName[1+9] :=$49; { I }
ObjName[1+10]:=$46; { F }
ObjName[1+11]:=$49; { I }
ObjName[1+12]:=$43; { C }
ObjName[1+13]:=$41; { A }
ObjName[1+14]:=$54; { T }
ObjName[1+15]:=$49; { I }
ObjName[1+16]:=$4F; { O }
ObjName[1+17]:=$4E; { N }
For a:=1 to 128 do
ObjName[1+17+a] := 0; {Null it out, could fill with any info }
End; { of with sc }
With regs do
Begin
AX:=$E300;
ES:=Seg(sr);
DI:=Ofs(sr);
DS:=Seg(pc);
SI:=Ofs(pc);
End; { of with regs }
MsDos(regs);
CheckSuccess;
End; { of WriteProp }
Procedure ReadProp;
Begin
with rpc do
Begin
native.wh := 6+1+14; { 6=fixed, 1=object name, 14=property name }
native.wl := $00;
fillchar(rpr.data,sizeof(rpr.data),0); { ensure the reply buffer }
{ starts out as all nulls }
rpr.native.wh := 130;
rpr.native.wl := $00;
func := $3D; { Read a Property Value }
objtyp.wl := $88;
objtyp.wh := $88;
objnmel := 1;
objname[1] := 74;
objname[1+1] := 1; { Segment to read }
ObjName[1+2] := 14; { PropName Length }
ObjName[1+3] :=$49; { I }
ObjName[1+4] :=$44; { D }
ObjName[1+5] :=$45; { E }
ObjName[1+6] :=$4E; { N }
ObjName[1+7] :=$54; { T }
ObjName[1+8] :=$49; { I }
ObjName[1+9] :=$46; { F }
ObjName[1+10]:=$49; { I }
ObjName[1+11]:=$43; { C }
ObjName[1+12]:=$41; { A }
ObjName[1+13]:=$54; { T }
ObjName[1+14]:=$49; { I }
ObjName[1+15]:=$4F; { O }
ObjName[1+16]:=$4E; { N }
End; { of with rpc }
With regs do
Begin
AX := $E300;
DS := Seg(rpc);
SI := Ofs(rpc);
ES := Seg(rpr);
DI := Ofs(rpr);
End;
MsDos(Regs);
CheckSuccess;
End; { end of ReadProp }
Begin
{
CreateObject;
CreateProp;
WriteProp;
ReadProp;
}
regs.ax:=$0010;
intr($10,regs);
a:=16;
for b:=639 downto 0 do
begin
a:=a-1;
regs.ax:=$0c00+a;
if a=0 then a:=16;
regs.bx:=0;
regs.dx:=10;
regs.cx:=b;
intr($10,regs);
end;
End.